package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.StockShopBean;
import com.project.service.IStockShopService;
import com.project.service.ISupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("shop")
@Api(tags = "商品库存")
public class StockShopController {
    @Autowired
    private IStockShopService shopService;
    @ApiOperation(value = "分页动态查询库存商品")
    @GetMapping("findByItem")
    public IPage findByItem(Integer pageNO, String name, String salePrice, String type, Integer startNum, Integer endNum) {
        return shopService.findByItem(pageNO, name, salePrice, type, startNum, endNum);
    }
    @ApiOperation(value = "按ID查看库存商品信息")
    @GetMapping("findById")
    public StockShopBean findById(String id) {
        return shopService.findById(id);
    }

    @ApiOperation(value = "按ID修改建议销售价")
    @PutMapping("update")
    public String update(String id, Integer price) {
        shopService.update(id, price);
        return "ok";
    }






}
